package com.agrm.member.controller;

import com.agrm.member.service.CaptchaService;
import com.agrm.model.common.dtos.ResponseResult;
import com.agrm.utils.EmailApi;
import jakarta.annotation.Resource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/api/v1/member/email")
public class CaptchaController {
 
    private final CaptchaService captchaService;

    public CaptchaController(CaptchaService captchaService) {
        this.captchaService = captchaService;
    }

    @Autowired
    EmailApi emailApi;

    @RequestMapping("/getCaptcha")
    public ResponseResult sendCaptcha(String email){
        boolean res = captchaService.sendCaptcha(email);
        if(res){
            return ResponseResult.okResult(200,"发送成功");
        }
        return ResponseResult.errorResult(-1,"发送失败");
    }
}